<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    html,body{
        height: 100%;
        margin: 0px;
        padding: 0px;
    }
    #contain{
        width: 400px;
        height: 250px;
        background-color: #00ee00;
    }
    .selectMenu{
        width: 150px;
        background-color: white;
        visibility: hidden;
        position: absolute;
        box-shadow: 0px 0px 10px #D1CEBC
    }
    .MenuItem{
        background-color: #fff;
        margin: 0;
    }
    .MenuButton{
        width: 146px;
        margin: 2px;
        border: 0;
        text-align: center;
        /*padding-left: 60px;*/
        padding-top: 5px;
        padding-bottom: 5px;
        background-color: #fff;
        color: #000;
    }
    .MenuButton:hover{
        background-color: #1f6377;
    }
</style>
<body onload="load()">

<div id="contain">
    右击显示菜单
</div>
<label id="labe1"></label>
<div id="select" class="selectMenu">
    <div class="MenuItem">
        <div id="btn1" class="MenuButton">菜单一</div>
    </div>
    <div class="MenuItem">
        <div id="btn2" class="MenuButton">菜单二</div>
    </div>
</div>


<script>
    function load() {
        document.oncontextmenu = function(e) {
            //阻止鼠标默认点击事件
            e.preventDefault();
            if (document.getElementById('select')){
                var menu1 = document.getElementById('select')
                menu1.style.display = 'block';

                document.body.onmousedown = function(e) {
                    menu1.style.left = e.offsetX + "px";
                    menu1.style.top = document.documentElement.scrollTop + e.clientY + "px";
                    if (e.button == 2) {
                        menu1.style.visibility = "visible";
                    } else {
                        menu1.style.visibility = "hidden";
                    }
                }
            }
            if(document.getElementById('btn1')){
                document.getElementById("btn1").onmousedown = function(e) {
                    document.getElementById('labe1').innerHTML = '这是内容一'
                }
                }

        }
        return false;

    }

    compute(10,100);
    var compute = function(A,B) {
        console.info(A * B) ;
    };
    function compute(A,B){
        console.info(A + B);
    }
    function compute(A,B){
        console.info((A + B)*2);
    }
    compute(2,10);
  

</script>
</body>
</html>